Skip to content

Add debug info. Fix target-uri logic. Redo JWK impl#23

Merged
leelynne merged 2 commits into
mainfrom
leef-debug-info
Jun 9, 2025
Merged

Add debug info. Fix target-uri logic. Redo JWK impl#23
leelynne merged 2 commits into
mainfrom
leef-debug-info

Conversation

@leelynne

@leelynne leelynne commented Jun 6, 2025

Copy link
Copy Markdown
Collaborator

Three key changes:

  • Redo JWK impl - move from storing the serialized subtype to storing the golang typed subtype. This makes it easier less error prone to work with including setting values that get serialized properly.
    During testing of this I found that the customer Transformer used for MetadataProvider was causing VerifyResult diffs to only partially compare since VerifyResult is assignable from MetadataProvider. Updated the compare logic to test the whole VerifyResult.

  • Fix target-uri logic - the code was trying to be generate the right result depending on if it was a client or server request but was wrong. It's not just always populating the value from the request URL.

  • Add debug info - add a per-request debug context that will return the signature base.

@leelynne leelynne self-assigned this Jun 6, 2025
@leelynne
leelynne marked this pull request as ready for review June 6, 2025 23:07
Comment thread keyutil/jwk.go
return jwk, nil
}

// ReadJWKFromPEM converts a PEM encoded private key to JWK. Use 'fields' to set additional fields like kty, and kid. alg is set based on the passed in PrivateKey.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: update comment to not mention "fields".

Comment thread keyutil/jwk.go
return FromPrivateKey(pkey)
}

// FromPrivateKey creates a JWK from a crypto.PrivateKey. Use 'fields' to set additional fields like kty, and kid. alg is set based on the passed in PrivateKey.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same(update comment)

Comment thread keyutil/jwk.go
Algorithm string // 'alg'
KeyID string // 'kid'
raw json.RawMessage
jtype any // the type of JWK based on KeyType.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the field jtype holds the concrete value. The name sounds like it's some type only, from direct look, but I think it's okay since it's not exposed 🤔

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good call out. I'll change it. jwtImpl or something similar might be more clear.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgtm, thanks!

@leelynne
leelynne merged commit d6afe7b into main Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants